import {ROUTES} from '@/utils/enums';
import {PaginationParams} from '@/utils/types';
import {
  CollectionDataType,
  FileCollectionDetail,
  FileCollectionProps,
  SearchParams
} from '@/utils/types/administrative/file-collection';
import {httpRequest} from '@/utils/umiRequest';

const baseURL = ROUTES.FILECOLLECTION
/**
 * @description: 创建文件收集任务
 * @param {FileCollectionProps} options
 * @author: YoungYa
 */
export const createFileCollectionTask = (options: FileCollectionProps) =>
  httpRequest.post<API.FILE_COLLECTION>(`${baseURL}`, options);

/**
 * @description: 获取文件收集任务列表
 * @param {SearchParams} options
 * @author: YoungYa
 */
export const getFileCollectionTaskList = (options?: SearchParams) =>
  httpRequest.get<{ list: CollectionDataType[], total: number } & PaginationParams>(`${baseURL}`, options);
/**
 * @description: 获取文件收集任务列表
 * @author: YoungYa
 * @param {string} id
 */
export const getFileCollectionTaskDetail = (id: string) =>
  httpRequest.get<FileCollectionDetail>(`${baseURL}/${id}`);

/**
 * @description: 删除文件收集任务
 * @param {string[]} task_id
 * @author: YoungYa
 */
export const delFileCollectionTask = (task_id: string[]) =>
  httpRequest.delete<string[]>(`${baseURL}`, {ids: task_id});
